#include<iostream>  
#include<cstring>  
#define N 105  
using namespace std;
int Mat[N][N];
void Output(int n);
int main() {
	int n;
	cin >> n;
	Output(n);
	return 0;
}
void Output(int n) {
	int i, j, cnt = 1;
	memset(Mat, 0, sizeof(Mat));
	i = 1;
	j = n;
	while (cnt <= n * n) {
		while (j > 0 && i <= n && !Mat[i][j])
			Mat[i++][j] = cnt++;
		i--;
		j--;
		while (j > 0 && !Mat[i][j])
			Mat[i][j--] = cnt++;
		j++;
		i--;
		while (i > 0 && !Mat[i][j])
			Mat[i--][j] = cnt++;
		i++;
		j++;
		while (j <= n && !Mat[i][j])
			Mat[i][j++] = cnt++;
		j--;
		i++;
	}
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			if (j != 1)
				cout << ' ' << Mat[i][j];
			else
				cout << Mat[i][j];
		}
		cout << endl;
	}
}
